package cn.ubeta.b2c.utils.preference;

import android.content.Context;
import java.util.Map;

/**
 * Created by liudengyong on 16/8/22.
 */

public abstract class AbstractSetting {

    private SharePreferenceUtil mSharePreferenceUtil;

    public AbstractSetting(Context context, String settingFileName) {
        mSharePreferenceUtil = new SharePreferenceUtil(context, settingFileName);
    }

    protected String getString(String key, String defValue) {
        return mSharePreferenceUtil.getStringValue(key, defValue);
    }

    protected boolean getBoolean(String key, boolean defValue) {
        return mSharePreferenceUtil.getBooleanValue(key, defValue);
    }

    protected float getFloat(String key, float defValue) {
        return mSharePreferenceUtil.getFloatValue(key, defValue);
    }

    protected int getInt(String key, int defValue) {
        return mSharePreferenceUtil.getIntValue(key, defValue);
    }

    protected long getLong(String key, long defValue) {
        return mSharePreferenceUtil.getLongValue(key, defValue);
    }

    protected boolean putBoolean(String key, boolean value) {
        return mSharePreferenceUtil.putBoolean(key, value);
    }

    protected boolean putString(String key, String value) {
        return mSharePreferenceUtil.putString(key, value);
    }

    protected boolean putFloat(String key, float value) {
        return mSharePreferenceUtil.putFloat(key, value);
    }

    protected boolean putLong(String key, long value) {
        return mSharePreferenceUtil.putLong(key, value);
    }

    protected boolean putInt(String key, int value) {
        return mSharePreferenceUtil.putInt(key, value);
    }

    @SuppressWarnings("rawtypes")
    public Map getAll() {
        return mSharePreferenceUtil.getAll();
    }

    public boolean contains(String key) {
        return mSharePreferenceUtil.contains(key);
    }

    public boolean delete(String key) {
        return mSharePreferenceUtil.delete(key);
    }

    public boolean clear() {
        return mSharePreferenceUtil.clear();
    }
}

